package com.macro.controller;

import com.macro.pojos.dto.ResponseResult;
import com.macro.pojos.dto.UiGoodsSkuDto;
import com.macro.service.UiGoodsSkuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/v1/sku")
@Api(tags = "sku管理")
public class UiGoodsSkuController {

    @Autowired
    UiGoodsSkuService uiGoodsSkuService;

    /**
     * 查询sku
     * @param goodsSn
     * @param userId
     * @return
     */
    @GetMapping("/querySku")
    @ApiOperation(value = "查询sku",notes = "查询sku")
    public ResponseResult querySku(@RequestParam String goodsSn, @RequestHeader Integer userId){
        return uiGoodsSkuService.querySku(goodsSn);
    }

    /**
     * 更改sku
     * @param uiGoodsSkuDtoList
     * @return
     */
    @PostMapping("/updateSku")
    @ApiOperation(value = "更改sku",notes = "更改sku")
    public ResponseResult updateSku(@RequestBody List<UiGoodsSkuDto> uiGoodsSkuDtoList, @RequestHeader Integer userId){
        return uiGoodsSkuService.updateSku(uiGoodsSkuDtoList);
    }

}
